package day01;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(value = "*.test",loadOnStartup = 0)
public class TestServlet extends HttpServlet {


    @Override
    public void init() throws ServletException {
        System.out.println("TestServlet.init");
    }

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("TestServlet.service");

        System.out.println("request.getContextPath() = " + request.getContextPath());
        System.out.println("request.getServletPath() = " + request.getServletPath());
        System.out.println("request.getRequestURL() = " + request.getRequestURL());
        System.out.println("request.getRequestURI() = " + request.getRequestURI());
    }

    @Override
    public void destroy() {
        System.out.println("TestServlet.destroy");
    }
}
